1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module sourceview.StyleSchemeManager;
26 
27 private import glib.ConstructionException;
28 private import glib.Str;
29 private import glib.c.functions;
30 private import gobject.ObjectG;
31 private import sourceview.StyleScheme;
32 private import sourceview.c.functions;
33 public  import sourceview.c.types;
34 
35 
36 /**
37  * Provides access to [class@StyleScheme]s.
38  */
39 public class StyleSchemeManager : ObjectG
40 {
41 	/** the main Gtk struct */
42 	protected GtkSourceStyleSchemeManager* gtkSourceStyleSchemeManager;
43 
44 	/** Get the main Gtk struct */
45 	public GtkSourceStyleSchemeManager* getStyleSchemeManagerStruct(bool transferOwnership = false)
46 	{
47 		if (transferOwnership)
48 			ownedRef = false;
49 		return gtkSourceStyleSchemeManager;
50 	}
51 
52 	/** the main Gtk struct as a void* */
53 	protected override void* getStruct()
54 	{
55 		return cast(void*)gtkSourceStyleSchemeManager;
56 	}
57 
58 	/**
59 	 * Sets our main struct and passes it to the parent class.
60 	 */
61 	public this (GtkSourceStyleSchemeManager* gtkSourceStyleSchemeManager, bool ownedRef = false)
62 	{
63 		this.gtkSourceStyleSchemeManager = gtkSourceStyleSchemeManager;
64 		super(cast(GObject*)gtkSourceStyleSchemeManager, ownedRef);
65 	}
66 
67 
68 	/** */
69 	public static GType getType()
70 	{
71 		return gtk_source_style_scheme_manager_get_type();
72 	}
73 
74 	/**
75 	 * Creates a new style manager.
76 	 *
77 	 * If you do not need more than one style manager
78 	 * then use [func@StyleSchemeManager.get_default] instead.
79 	 *
80 	 * Returns: a new #GtkSourceStyleSchemeManager.
81 	 *
82 	 * Throws: ConstructionException GTK+ fails to create the object.
83 	 */
84 	public this()
85 	{
86 		auto __p = gtk_source_style_scheme_manager_new();
87 
88 		if(__p is null)
89 		{
90 			throw new ConstructionException("null returned by new");
91 		}
92 
93 		this(cast(GtkSourceStyleSchemeManager*) __p, true);
94 	}
95 
96 	/**
97 	 * Returns the default #GtkSourceStyleSchemeManager instance.
98 	 *
99 	 * Returns: a #GtkSourceStyleSchemeManager. Return value
100 	 *     is owned by GtkSourceView library and must not be unref'ed.
101 	 */
102 	public static StyleSchemeManager getDefault()
103 	{
104 		auto __p = gtk_source_style_scheme_manager_get_default();
105 
106 		if(__p is null)
107 		{
108 			return null;
109 		}
110 
111 		return ObjectG.getDObject!(StyleSchemeManager)(cast(GtkSourceStyleSchemeManager*) __p);
112 	}
113 
114 	/**
115 	 * Appends @path to the list of directories where the @manager looks for
116 	 * style scheme files.
117 	 *
118 	 * See [method@StyleSchemeManager.set_search_path] for details.
119 	 *
120 	 * Params:
121 	 *     path = a directory or a filename.
122 	 */
123 	public void appendSearchPath(string path)
124 	{
125 		gtk_source_style_scheme_manager_append_search_path(gtkSourceStyleSchemeManager, Str.toStringz(path));
126 	}
127 
128 	/**
129 	 * Mark any currently cached information about the available style schems
130 	 * as invalid.
131 	 *
132 	 * All the available style schemes will be reloaded next time the @manager is accessed.
133 	 */
134 	public void forceRescan()
135 	{
136 		gtk_source_style_scheme_manager_force_rescan(gtkSourceStyleSchemeManager);
137 	}
138 
139 	/**
140 	 * Looks up style scheme by id.
141 	 *
142 	 * Params:
143 	 *     schemeId = style scheme id to find.
144 	 *
145 	 * Returns: a #GtkSourceStyleScheme object.
146 	 *     The returned value is owned by @manager and must not be unref'ed.
147 	 */
148 	public StyleScheme getScheme(string schemeId)
149 	{
150 		auto __p = gtk_source_style_scheme_manager_get_scheme(gtkSourceStyleSchemeManager, Str.toStringz(schemeId));
151 
152 		if(__p is null)
153 		{
154 			return null;
155 		}
156 
157 		return ObjectG.getDObject!(StyleScheme)(cast(GtkSourceStyleScheme*) __p);
158 	}
159 
160 	/**
161 	 * Returns the ids of the available style schemes.
162 	 *
163 	 * Returns: a %NULL-terminated array of strings containing the ids of the available
164 	 *     style schemes or %NULL if no style scheme is available.
165 	 *     The array is sorted alphabetically according to the scheme name.
166 	 *     The array is owned by the @manager and must not be modified.
167 	 */
168 	public string[] getSchemeIds()
169 	{
170 		return Str.toStringArray(gtk_source_style_scheme_manager_get_scheme_ids(gtkSourceStyleSchemeManager));
171 	}
172 
173 	/**
174 	 * Returns the current search path for the @manager.
175 	 *
176 	 * See [method@StyleSchemeManager.set_search_path] for details.
177 	 *
178 	 * Returns: a %NULL-terminated array
179 	 *     of string containing the search path.
180 	 *     The array is owned by the @manager and must not be modified.
181 	 */
182 	public string[] getSearchPath()
183 	{
184 		return Str.toStringArray(gtk_source_style_scheme_manager_get_search_path(gtkSourceStyleSchemeManager));
185 	}
186 
187 	/**
188 	 * Prepends @path to the list of directories where the @manager looks
189 	 * for style scheme files.
190 	 *
191 	 * See [method@StyleSchemeManager.set_search_path] for details.
192 	 *
193 	 * Params:
194 	 *     path = a directory or a filename.
195 	 */
196 	public void prependSearchPath(string path)
197 	{
198 		gtk_source_style_scheme_manager_prepend_search_path(gtkSourceStyleSchemeManager, Str.toStringz(path));
199 	}
200 
201 	/**
202 	 * Sets the list of directories where the @manager looks for
203 	 * style scheme files.
204 	 *
205 	 * If @path is %NULL, the search path is reset to default.
206 	 *
207 	 * Params:
208 	 *     path = a %NULL-terminated array of
209 	 *         strings or %NULL.
210 	 */
211 	public void setSearchPath(string[] path)
212 	{
213 		gtk_source_style_scheme_manager_set_search_path(gtkSourceStyleSchemeManager, Str.toStringzArray(path));
214 	}
215 }